class Menu:
	def __init__(self):
		self.handlers = list()

	def add_handler(self, fio):
		def decorator_set_handler(handler):
			self.handlers.append([fio, handler])
			return handler
		return decorator_set_handler

	def run(self):
		while True:
			try:
				print()
				for i,item in enumerate(self.handlers, 1):
					print(f"{i}. {item[0]}")
				command = int(input("Input command: ")) - 1
				self.handlers[command][1]()
				if self.handlers[command][0] == "Exit":
					break
			except Exception as e:
				print(e)
#				raise(e)

